﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.UI.HtmlControls;
using LibraryO2S;

public partial class Administrator_BusinessEmailReciever : System.Web.UI.Page
{

   // BizReport report = new BizReport();
    BusinessEmail email = new BusinessEmail();
    BindToControls bind = new BindToControls();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadData();
           
        }
    }
    
    private void LoadData()
    {
        try
        {
            bind.BindRepeater(rptData, email.CheckAll());
            if (rptData.Items.Count == 0)
            {
                divMessage.InnerHtml = O2S_Message.Warning("Cảnh Báo", "Chưa Có dữ liệu trong mục này!");
            }
        }
        catch
        {
            divMessage.InnerHtml = O2S_Message.Warning("Cảnh Báo", "Chưa Có dữ liệu trong mục này!");
        }
    }
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        try
        {

            string del_list = hdfCheck.Value;
            string[] sp_list = del_list.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < sp_list.Length; i++)
            {
                //  admin.DeleteAdmin(sp_list[i]);
               // report.Delete(int.Parse(sp_list[i]));
            }
            LoadData();
        }
        catch (Exception ex)
        {

            divMessage.InnerHtml = O2S_Message.Error("Cảnh Báo", "Phát hiện lỗi! " + ex.Message);
        }

    }
    protected void btnAdnew1_Click(object sender, EventArgs e)
    {
        Response.Redirect("BusinessEmailRecieverAdd.aspx");
    }
}